#include "setwig.h"
#include "ui_setwig.h"

SetWig::SetWig(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SetWig)
{
    ui->setupUi(this);
    QObject::connect(this, SIGNAL(dataUpSignal(QByteArray)),
                     this, SLOT(dataUpSlot(QByteArray)));

    timer = new QTimer(this);

    // 提前刷新显式控件
    timeoutSlot();

    timer->setInterval(500);   // 设置时间间隔1秒钟
    timer->setSingleShot(false);    // 为周期循环

    // 连接信号槽要在启动定时器之前连接
    connect(timer,SIGNAL(timeout()),this,
        SLOT(timeoutSlot()));

    // 启动定时器
    timer->start();
}

SetWig::~SetWig()
{
    delete ui;
}
//接收数据并显示
void SetWig::dataUpSlot(QByteArray)
{

}

void SetWig::timeoutSlot()
{
    // 获取当前系统时间，转换为：时:分:秒
        QString str = QDateTime::currentDateTime().toString("hh:mm:ss");
        ui->lcdNumber->display(str);

}
